package com.sumainfor.pc.market.service;

import com.alibaba.fastjson.JSONObject;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.util.ObjectUtil;
import com.sumainfor.pc.market.dao.HousingConInfoMapper;
import com.sumainfor.pc.market.dao.HousingauditMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;

@Service
public class HousingConInfoService {

    private ReentrantLock lock = new ReentrantLock(false);

    Logger log = LoggerFactory.getLogger(HousingConInfoService.class);// 日志

    @Autowired
    HousingConInfoMapper housingConInfoMapper;

    @Autowired
    HousingauditMapper mapper;

   public JsonResult getConInfo(Map<String,Object> params){
       JsonResult result =new JsonResult();
//       String HouConId= mapper.getHouConId(params);////通过房源id获取HouConId
////       Map<String,Object>maps= housingConInfoMapper.getConInfo(HouConId,3);//首先查询出这个无限网络
////       Map<String,Object> map = new HashMap<String, Object>();
////           JSONObject jsonObject = JSONObject.parseObject(maps.get("WiFi").toString());//JSON转成map
////           map.put("IfWiFi",maps.get("IfWiFi"));//获取是否开启
////           map.put("yys",jsonObject.get("yys"));//获取网络运行商
////           map.put("lxr",jsonObject.get("lxr"));//获取联系人
////           map.put("lxhm",jsonObject.get("lxhm"));//获得联系号码
////       Map<String,Object>mapz= housingConInfoMapper.getConInfo(HouConId,4);//首先查询出有线电视
////       map.put("IfYx",mapz.get("IfWiFi"));
////       result.put(map);
       return  result;
    }

    public JsonResult gettcmktHousing(List<Map<String,Object>> params){
            JsonResult result = new JsonResult();
            try {
                List<Map<String,Object>> mapList = new ArrayList<Map<String, Object>>();
                for (Map<String,Object> map:params) {
                    mapList.add(housingConInfoMapper.gettcmktHousing(map.get("HouId").toString()));
                }
                result.put(mapList);
            }catch (Exception e){
                result.putFailed("服务器繁忙...");
            }
            return  result;
    }

}
